package com.volcreate.guoqing.no5;

import java.util.*;

/**
 * @author zxc
 * @date 2020/9/24
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String s = scanner.nextLine();
        HashSet<String> list1 = new HashSet<>();
        HashSet<String> list2 = new HashSet<>();
        String[] split = s.split("\\s+");

        Arrays.stream(split).forEach(str -> {
            if (list1.size() < 5) {
                list1.add(str);
            } else if (list2.size() < 5) {
                list2.add(str);
            }
        });
        list1.addAll(list2);

        ArrayList<String> list = new ArrayList<>(list1);
        list.stream().distinct().sorted().forEach(System.out::println);

        scanner.close();
    }
}
